<?php


/**
 * +-------------------------------------------------------------
 * |Caption:
 * +-------------------------------------------------------------
 * |Author: Lenny
 * +-------------------------------------------------------------
 * |Email:  1685964109@qq.com
 * +-------------------------------------------------------------
 * |Date:   2024-03-12 09:42
 * +-------------------------------------------------------------
 */

use app\service\middleware\CheckDomain;
use think\facade\Route;
use app\service\middleware\LoginLimit;
use app\service\middleware\Token;

//登录
Route::group('login', function () {
    Route::post('login', 'login/login');//登录
    Route::post('login_mobile', 'login/loginMobile');//短信登录
    Route::get('sms', 'login/sendSms');//短信验证码
    Route::get('captcha', 'login/captcha');//验证码
});

//首页
Route::group('goods', function () {
    Route::post('cate', 'GoodsCate/search');//商品分类
    Route::post('list', 'CompanyGoods/list');//商品列表
    Route::post('rule', 'CompanyGoods/rule');//商品规格
    Route::post('detail', 'CompanyGoods/detail');//商品详情
})->middleware(Token::class);

//购物车
Route::group('cart', function () {
    Route::post('list', 'StoreCart/list');//列表
    Route::post('create', 'StoreCart/add');//添加/减少
    Route::post('del', 'StoreCart/del');//删除购物车
    Route::get('salesman_list','storeCart/salesmanList');//业务员购物车列表
})->middleware(Token::class);


//结算
Route::group('settle', function () {
    Route::get('get_store', 'StoreOrder/getSalesmanStore');//获取业务员绑定门店
    Route::post('index', 'order.Checkout/index');//结算台
    Route::post('order_add', 'StoreOrder/settlement');//下单
    Route::post('pay', 'StoreOrder/pay');//支付
    Route::post('salesman_pay', 'StoreOrder/salesmanPay');//业务员下单支付

    Route::post('salesman_index', 'order.Checkout/salesmanIndex'); //业务员结算台
    Route::post('salesman_buy', 'order.Checkout/salesmanSettle'); // 业务元立即下单结算台
    Route::post('salesman_edit_price', 'order.Checkout/salesmanEditPrice'); // 业务员修改价格
})->middleware(Token::class);

//支付回调
Route::group('notify', function () {
    Route::post('store_order', 'Notify/storeOrder');//支付回调
    Route::post('store_order_refund', 'Notify/storeOrderRefund');//退款回调
});

// 门店商品列表
Route::group('store', function () {
    Route::get('goods', 'StoreGoods/list');//商品列表
})->middleware(Token::class);

//我的
Route::group('my', function () {
    //余额
    Route::get('balance', 'StoreUser/balance');
    //绑定的门店
    Route::get('store', 'StoreUser/store');
    //订单列表
    Route::group('order', function () {
        Route::get('list', 'StoreOrder/list');//我的订单列表
        Route::get('cancel', 'StoreOrder/cancel')->append(['order_status'=> 5]);//我的订单列表--取消订单
        Route::get('confirm', 'StoreOrder/confirm')->append(['order_status'=> 4]);//我的订单列表--确认收货
        Route::get('detail', 'StoreOrder/detail');//我的订单列表--订单详情
    });
})->middleware(Token::class);

